import {RouteRecordRaw} from 'vue-router'

const asyncRoutes: RouteRecordRaw[] = [
    {
        path: '/',
        name: 'Home',
        redirect: '/homePage',
        meta: {
            title: '首页',
            public: true,
        },
        component: () => import('@/views/home/index.vue'),
        children: [
            {
                path: 'homePage',
                name: 'HomePage',
                meta: {
                    title: '首页',
                    public: true,
                },
                component: () => import('@/views/home/components/home/index.vue'),
            },
            // 图片展示
            {
                path: 'images',
                name: 'Images',
                meta: {
                    title: '图片',
                    public: true,
                    // roles: ['admin'],
                },
                component: () => import('@/views/images/index.vue'),
            },
            {
                path: 'article',
                name: 'Article',
                meta: {
                    title: '文章',
                    public: true,
                },
                component: () => import('@/views/article/index.vue'),
            },
            // 用户
            {
                path: 'user',
                name: 'User',
                meta: {
                    title: '用户',
                    public: false,
                    // roles: ['admin'],
                },
                component: () => import('@/views/user/index.vue'),
            },
            {
                path: 'timeAxis',
                name: 'TimeAxis',
                meta: {
                    title: '时间轴',
                    public: false,
                },
                component: () => import('@/views/timeAxis/index.vue'),
            },
            {
                path: 'ai',
                name: 'AI',
                meta: {
                    title: 'AI',
                    public: true,
                },
                component: () => import('@/views/ai/index.vue'),
            },
        ],
    },
    {
        path: '/oauth2',
        name: 'Oauth2',
        meta: {
            title: 'Oauth2',
            public: true,
        },
        component: () => import('@/views/oauth2/index.vue'),
    },
    {
        path: '/admin',
        name: 'Admin',
        meta: {
            title: '管理后台',
            public: false,
            roles: ['admin'],
        },
        component: () => import('@/views/admin/index.vue'),
    },
    {
        path: '/editor',
        name: 'Editor',
        meta: {
            title: '富文本编辑',
            public: false,
            // roles: ['admin'],
        },
        component: () => import('@/views/editor/index.vue'),
    },
    {
        path: '/blog',
        name: 'Blog',
        meta: {
            title: '博客',
            public: true,
            // roles: ['admin'],
        },
        component: () => import('@/views/blog/index.vue'),
    },
    {
        path: '/upload',
        name: 'Upload',
        meta: {
            title: '图片上传',
            public: false,
            // roles: ['admin'],
        },
        component: () => import('@/views/upload/index.vue'),
    },
    // 发布作品
    {
        path: '/publish',
        name: 'Publish',
        meta: {
            title: '发布作品',
            public: false,
            // roles: ['admin'],
        },
        component: () => import('@/views/publish/index.vue'),
    },
    {
        path: '/detail',
        name: 'Detail',
        meta: {
            title: '图片详情',
            public: true,
            // roles: ['admin'],
        },
        component: () => import('@/views/imagesDetail/index.vue'),
    },
    {
        path: '/articleDetail',
        name: 'ArticleDetail',
        meta: {
            title: '文章详情',
            public: true,
            // roles: ['admin'],
        },
        component: () => import('@/views/articleDetail/index.vue'),
    },
    {
        path: '/userDetail',
        name: 'UserDetail',
        meta: {
            title: '用户详情，',
            public: false,
        },
        component: () => import('@/views/userDetail/index.vue'),
    },
]

export {asyncRoutes}
